//index.js  提供访问接口的api
import myaxios from "@/myaxios/myaxios"
import URL_ENV from "@/myaxios/BaseUrl"

const BMDURL = URL_ENV.BMDURL
const actorApi = {
  /** 查询所有产品类型 */
  queryAll() {
    const url = BMDURL + "/type"

    return myaxios.get(url)
  },
  /**
   * 通过产品类型查询产品
   * @param {*} params
   * @returns
   */
  queryByTypeName(params) {
    const url = BMDURL + "/type"

    return myaxios.get(url, params)
  },
  /**
   * 查询所有产品
   */
  queryCPAll() {
    const url = BMDURL + "/chanpin"

    return myaxios.get(url)
  },
/**
   * 通过id删除购物车
   */
deleteById(params) {
  const url = BMDURL + "/gouwuche/" + params
  return myaxios.delete(url, params)
},

  /**
   * 通过id查询产品详情
   */
  queryById(params) {
    const url = BMDURL + "/chanpin?id=" + params
    return myaxios.get(url, params)
  },


  /**
   * 通过类型查询
   */
  selectLike(params) {
    const url = BMDURL + "/chanpin?" + params
    return myaxios.get(url, params)
  },

  // 查看购物车
    queryGouWuChe(){
      const url = BMDURL + "/gouwuche"
      return myaxios.get(url)
    },
  // 添加购物车
  getGouWuChe(params){
    const url = BMDURL + "/gouwuche"
    return myaxios.post(url, params)
  },
  /**
   * 通过id修改购物车数量
   */
  gouwuchenumById(params) {
    const url = BMDURL + "/gouwuche/" + params.id
    return myaxios.put(url, params)
  },
/**
   * 查询所有订单列表
   */
queryAllDingdan() {
  const url = BMDURL + "/dingdan"
  return myaxios.get(url)
},
  // 查看购物订单
  queryDingDan(){
    const url = BMDURL + "/dingdan"
    return myaxios.get(url)
  },
  // 添加购物订单
  getDingDan(params){
    const url = BMDURL + "/dingdan"
    return myaxios.post(url, params)
  },
}

export default actorApi
